package com.example.base.freemarker.tag;

import com.alibaba.fastjson.JSONObject;
import com.example.base.freemarker.DirectiveHandler;
import com.example.base.freemarker.FreemarkerScan;
import com.example.base.freemarker.TemplateDirective;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @Classname TitleListTemplate
 * @Description TODO
 * @Date 2023/9/17 4:05
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@FreemarkerScan("list")
public class ListTemplate extends TemplateDirective {

    @Override
    public String getName() {
        return "list";
    }

    @Override
    public void execute(DirectiveHandler handler) throws Exception {
        Integer pageNum=handler.getInteger("pageNum");
        Integer pageSize=handler.getInteger("pageSize");
        Map<String, Object> map = new HashMap<>();
        map.put("total",0);
        map.put("records",JSONObject.toJSONString(new ArrayList<>()));
        handler.put(RESULT,map).render();
    }
}